# This file is part of WSAP web sockets server module.
# Copyright (c) 2010 Brandon Orther. All rights reserved.

class WsapException (Exception):
    pass

class InvalidTask (WsapException):
    pass

def wsFrame(data):
    """
    This function will put a WebSockets frame (\x00, \xFF) around data while insuring there are not any encoding issue.

    Params:
        (String) data

    Retrun:
        (String) This will be a byte string
    """
    return "\x00%s\xFF" % data.encode()
